package com.whcoding.designpatterns.pattern.adapter;

/**
 * @program: spring-boot-learning
 * @description:
 * @author: whcoding
 * @create: 2022-09-20 16:59
 **/
public class AdaptorTests {

	public static void main(String[] args) {
		charging(new VoltageAdaptor());
		System.out.println("————————对象适配器————————");
		charging(new ObjectVoltageAdaptor(new Voltage220V()));
	}

	public static void charging(IVoltage5V voltage5V) {
		if (5 == voltage5V.output5V()) {
			System.out.println("电压为5V，可以进行充电~~~");
		} else if (voltage5V.output5V() > 5) {
			System.out.println("电压大于5V，不可以进行充电~~~");
		}
	}


}
